Minor cleanups, in preparation for merging with mainline.
Removal of some debug hooks.
Signed-off-by: michael.fetterman@cl.cam.ac.uk
d->shared_info = (void *)alloc_xenheap_page();
memset(d->shared_info, 0, PAGE_SIZE);
ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
- SHARE_PFN_WITH_DOMAIN2(virt_to_page(d->shared_info), d);
+ SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
machine_to_phys_mapping[virt_to_phys(d->shared_info) >>
PAGE_SHIFT] = INVALID_M2P_ENTRY;
mk_l3_pgentry(__pa(d->arch.mm_perdomain_l2) | __PAGE_HYPERVISOR);
#endif
- shadow_lock_init(d);
+ shadow_lock_init(d);
INIT_LIST_HEAD(&d->arch.free_shadow_frames);
}
}
d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
d->shared_info->n_vcpu = smp_num_cpus;
- /* setup monitor table */
+ /* Set up monitor table */
update_pagetables(ed);
/* Install the new page tables. */
for ( pfn = 0; pfn < d->tot_pages; pfn++ )
{
mfn = pfn + (alloc_start>>PAGE_SHIFT);
-#if 0
#ifndef NDEBUG
#define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
- if ( pfn > REVERSE_START )
+ if ( !opt_dom0_translate && (pfn > REVERSE_START) )
mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START);
-#endif
#endif
((u32 *)vphysmap_start)[pfn] = mfn;
machine_to_phys_mapping[mfn] = pfn;
}
-void _put_page_type(struct pfn_info *page)
+void put_page_type(struct pfn_info *page)
{
u32 nx, x, y = page->u.inuse.type_info;
}
-int _get_page_type(struct pfn_info *page, u32 type)
+int get_page_type(struct pfn_info *page, u32 type)
{
u32 nx, x, y = page->u.inuse.type_info;
case MMU_MACHPHYS_UPDATE:
- // HACK ALERT... This about this later...
+ // HACK ALERT... Need to think about this some more...
//
if ( unlikely(shadow_mode_translate(FOREIGNDOM) && IS_PRIV(d)) )
{
* arch/x86/shadow.c
*
* Copyright (c) 2005 Michael A Fetterman
+ * Based on an earlier implementation by Ian Pratt et al
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
ASSERT( phystab );
-#ifdef WATCH_MAP_DOMAIN_CALLERS
- int old_map_domain_mem_noisy = map_domain_mem_noisy;
- map_domain_mem_noisy = 0;
-#endif
-
l2 = map_domain_mem(phystab);
if ( !l2_pgentry_val(l2e = l2[l2_table_offset(va)]) )
{
__PAGE_HYPERVISOR);
unmap_domain_mem(l1);
-#ifdef WATCH_MAP_DOMAIN_CALLERS
- map_domain_mem_noisy = old_map_domain_mem_noisy;
-#endif
-
return 1;
}
list_ent = page->list.next;
}
+ list_ent = d->xenpage_list.next;
+ while ( list_ent != &d->xenpage_list )
+ {
+ page = list_entry(list_ent, struct pfn_info, list);
+ mfn = page_to_pfn(page);
+ pfn = machine_to_phys_mapping[mfn];
+ if ( (pfn != INVALID_M2P_ENTRY) &&
+ (pfn < (1u<<20)) )
+ {
+ set_p2m_entry(d, pfn, mfn);
+ }
+
+ list_ent = page->list.next;
+ }
+
return 1;
}
#include <xen/config.h>
#include <xen/sched.h>
-#include <xen/config.h>
#define DEFINE(_sym, _val) \
__asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
BLANK();
DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
-
-#if PERF_COUNTERS
- OFFSET(PERFC_hypercalls, struct perfcounter, hypercalls);
- OFFSET(PERFC_exceptions, struct perfcounter, exceptions);
-#endif
}
/* Use a spare PTE bit to mark entries ready for recycling. */
#define READY_FOR_TLB_FLUSH (1<<10)
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-int map_domain_mem_noisy = 1;
-#endif
-
-
static void flush_all_ready_maps(void)
{
unsigned long *cache = mapcache;
while ( ((unsigned long)(++cache) & ~PAGE_MASK) != 0 );
}
-void *_map_domain_mem(unsigned long pa)
+
+void *map_domain_mem(unsigned long pa)
{
unsigned long va;
unsigned int idx, cpu = smp_processor_id();
printk("Scrubbing Free RAM: ");
-#ifdef WATCH_MAP_DOMAIN_CALLERS
- int old_map_domain_mem_noisy = map_domain_mem_noisy;
- map_domain_mem_noisy = 0;
-#endif
-
for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ )
{
/* Every 100MB, print a progress dot and appease the watchdog. */
spin_unlock_irqrestore(&heap_lock, flags);
}
-#ifdef WATCH_MAP_DOMAIN_CALLERS
- map_domain_mem_noisy = old_map_domain_mem_noisy;
-#endif
-
printk("done.\n");
}
pg[i].count_info, pg[i].u.inuse.type_info);
}
- ASSERT( (pg[i].u.inuse.type_info & PGT_count_mask) == 0 );
+ ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
pg[i].tlbflush_timestamp = tlbflush_current_time();
pg[i].u.free.cpu_mask = cpu_mask;
list_del(&pg[i].list);
list_add_tail(&(_pfn)->list, &(_dom)->xenpage_list); \
spin_unlock(&(_dom)->page_alloc_lock); \
} while ( 0 )
-#define SHARE_PFN_WITH_DOMAIN2(_pfn, _dom) \
- do { \
- page_set_owner((_pfn), (_dom)); \
- /* The incremented type count is intended to pin to 'writable'. */ \
- (_pfn)->u.inuse.type_info = PGT_writable_page | PGT_validated | 1; \
- wmb(); /* install valid domain ptr before updating refcnt. */ \
- spin_lock(&(_dom)->page_alloc_lock); \
- /* _dom holds an allocation reference + writable ref */ \
- ASSERT((_pfn)->count_info == 0); \
- (_pfn)->count_info |= PGC_allocated | 2; \
- if ( unlikely((_dom)->xenheap_pages++ == 0) ) \
- get_knownalive_domain(_dom); \
- list_add_tail(&(_pfn)->list, &(_dom)->page_list); \
- spin_unlock(&(_dom)->page_alloc_lock); \
- } while ( 0 )
extern struct pfn_info *frame_table;
extern unsigned long frame_table_size;
return 1;
}
-//#define MFN1_TO_WATCH 0x1d8
-#ifdef MFN1_TO_WATCH
-#define get_page_type(__p, __t) ( \
-{ \
- struct pfn_info *_p = (__p); \
- u32 _t = (__t); \
- if ( page_to_pfn(_p) == MFN1_TO_WATCH ) \
- printk("get_page_type(%x) c=%p ot=%p @ %s:%d in %s\n", \
- MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info, \
- frame_table[MFN1_TO_WATCH].u.inuse.type_info, \
- __FILE__, __LINE__, __func__); \
- _get_page_type(_p, _t); \
-})
-#define put_page_type(__p) ( \
-{ \
- struct pfn_info *_p = (__p); \
- if ( page_to_pfn(_p) == MFN1_TO_WATCH ) \
- printk("put_page_type(%x) c=%p ot=%p @ %s:%d in %s\n", \
- MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info, \
- frame_table[MFN1_TO_WATCH].u.inuse.type_info, \
- __FILE__, __LINE__, __func__); \
- _put_page_type(_p); \
-})
-#else
-#define _get_page_type get_page_type
-#define _put_page_type put_page_type
-#endif
-
-void _put_page_type(struct pfn_info *page);
-int _get_page_type(struct pfn_info *page, u32 type);
+void put_page_type(struct pfn_info *page);
+int get_page_type(struct pfn_info *page, u32 type);
int get_page_from_l1e(l1_pgentry_t l1e, struct domain *d);
void put_page_from_l1e(l1_pgentry_t l1e, struct domain *d);
* include/asm-x86/shadow.h
*
* Copyright (c) 2005 Michael A Fetterman
+ * Based on an earlier implementation by Ian Pratt et al
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
extern unsigned long *mapcache;
#define MAPCACHE_ENTRIES 1024
-
-//#define WATCH_MAP_DOMAIN_CALLERS 1
-#ifdef WATCH_MAP_DOMAIN_CALLERS
-extern int map_domain_mem_noisy;
-#define map_domain_mem(__mdm_pa) ( \
-{ \
- unsigned long _mdm_pa = (__mdm_pa); \
- if ( map_domain_mem_noisy ) \
- printk("map_domain_mem(%p) @ %s:%d in %s\n", \
- _mdm_pa, __FILE__, __LINE__, __func__); \
- _map_domain_mem(_mdm_pa); \
-})
-#else
-#define _map_domain_mem map_domain_mem
-#endif
-
/*
* Maps a given physical address, returning corresponding virtual address.
* The entire page containing that VA is now accessible until a
* corresponding call to unmap_domain_mem().
*/
-extern void *_map_domain_mem(unsigned long pa);
+extern void *map_domain_mem(unsigned long pa);
/*
* Pass a VA within a page previously mapped with map_domain_mem().